using System;

namespace Magiq.Behaviors
{
    public class MagiqBehaviorCaller<TBehavior> : IMagiqBehaviorCaller<TBehavior> where TBehavior : IMagiqBehavior
    {
        private readonly IMagiqBehavior next;

        public MagiqBehaviorCaller(IMagiqBehavior next)
        {
            this.next = next;
        }

        #region IMagiqBehaviorCaller<TBehavior> Members

        public TReturn Call<TReturn>(Func<TBehavior, TReturn> action)
        {
            return MagiqBehavior.Execute(next, action);
        }

        public void Call(Action<TBehavior> action)
        {
            MagiqBehavior.Execute(next, action);
        }

        #endregion
    }
}